package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildVaccineBean;
import com.xuxin.baby.bean.ChildVaccineHistoryBean;
import com.xuxin.baby.contract.ChildVaccineHistoryContract;
import com.xuxin.baby.model.ChildVaccineHistoryModel;

/**
 * Created by xu_xin
 * Created on 2020/11/20 0020
 * 疫苗记录
 */
public class ChildVaccineHistoryPresenter implements ChildVaccineHistoryContract.Presenter {
    private final ChildVaccineHistoryModel model;
    private final ChildVaccineHistoryContract.View view;

    public ChildVaccineHistoryPresenter(ChildVaccineHistoryContract.View view) {
        this.view = view;
        model = new ChildVaccineHistoryModel();
    }

    @Override
    public void getChildVaccineHistory(String tenantId, String token, String childId, int skipCount) {
        model.getChildVaccineHistory(this, tenantId, token, childId, skipCount);
    }

    @Override
    public void onSuccess(ChildVaccineHistoryBean childVaccineHistoryBean) {
        if (null != view) {
            view.onSuccess(childVaccineHistoryBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}